﻿@{
    ViewBag.Title = "产品价格审核";
    var product = ViewBag.Product as CubicFWNet.Data.Models.Product;
}

<section class="content-header">
    <h1>
        产品审核
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index","Home")">首页</a></li>
        <li class="active">产品审核</li>
    </ol>
</section>

<section class="content">
    <form class="form-horizontal" method="post" id="formMain">
        <div class="box box-solid">
            <div class="box-body">
                <div class="row">
                    <input type="hidden" name="ProductID" value="@product.Id" />
                    <input type="hidden" id="modalData" value="@product.Data">
                    <input type="hidden" id="Data" name="Data" />
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="ProductName" class="col-sm-3 control-label">产品名称</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="ProductName" name="ProductName" value="@product.Name">
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Number" class="col-sm-3 control-label">产品编号</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Number" name="Number" value="@product.Number">
                        </div>
                    </div>

                    <div class="form-group col-md-6 col-sm-12" style="display:none">
                        <label for="Format" class="col-sm-3 control-label">产品规格</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Format" name="Format" value="@product.Format" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Pack" class="col-sm-3 control-label">包装单位</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Pack" name="Pack" value="@product.Pack" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Unit" class="col-sm-3 control-label">基本单位</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Unit" name="Unit" value="@product.Unit" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Length" class="col-sm-3 control-label">长度-mm</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Length" name="Length" value="@product.SizeLenth" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Width" class="col-sm-3 control-label">宽度-mm</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Width" name="Width" value="@product.SizeWidth" />
                        </div>
                    </div>
                    <div id="json-content"></div>
                </div>

                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Explain" class="col-sm-3 control-label">产品特点</label>
                        <div class="col-sm-9">
                            <textarea rows="3" class="form-control" id="Explain" name="Explain" readonly="readonly">@product.Explain</textarea>
                        </div>
                    </div>

                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Memo" class="col-sm-3 control-label">备注</label>
                        <div class="col-sm-9">
                            <textarea rows="3" class="form-control" id="Memo" name="Memo" readonly="readonly">@product.Memo</textarea>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Creator" class="col-sm-3 control-label">创建人</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="Creator" name="Tolerance" value="@ViewBag.RealName" readonly="readonly" />
                        </div>
                    </div>
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="CreateTime" class="col-sm-3 control-label">创建时间</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" id="CreateTime" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm")" readonly="readonly" />
                        </div>
                    </div>
                </div>

                <div class="row">
                    <br />
                    <div class="form-group col-md-6 col-sm-12">
                        <label for="Price" class="col-sm-3 control-label">确认价格</label>
                        <div class="col-sm-9">
                            <input type="number" class="form-control" id="Price" name="Price" value="@product.Price" />
                        </div>
                    </div>
                </div>
            </div>

            <div class="box-footer">
                <div class="box-footer">
                    <span class="btn btn-primary" onclick="FormSub()">确 定</span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <a class="btn btn-primary" href="@Url.Action("ProList","SalerDirector")">返 回</a>
                </div>
            </div>
        </div>
    </form>
</section>

@section Scripts {
    <script type="text/javascript">

        //禁用input
        $("input").prop("readonly", "readonly");
        $("#Price").removeAttr("readonly");


        //提交表单
        function FormSub() {
            var name = $("#ProductName").val().trim();
            if (name == "") {
                $.modalAlert("请输入产品名称", "warning");
                return false;
            }

            var number = $("#Number").val().trim();
            if (number == "") {
                $.modalAlert("请输入产品编号", "warning");
                return false;
            }

            var length = $("#Length").val().trim();
            if (length == "") {
                $.modalAlert("请输入产品长度", "warning");
                return false;
            }

            var width = $("#Width").val().trim();
            if (width == "") {
                $.modalAlert("请输入产品宽度", "warning");
                return false;
            }

            var price = $("#Price").val().trim();
            if (price == "") {
                $.modalAlert("请输入产品价格", "warning");
                return false;
            }

            $("#formMain").submit();
        }

    </script>
}